/*
 ============================================================================
 Page	     : 114
 Name        : min_sec.c
 Date	     : 20210403
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 把秒数转换成分和秒
 ============================================================================
 */

#include <stdio.h>
#define SEC_PER_MIN 60 		// 1分钟60秒
int main(void)
{
	int sec = 0;
	int min = 0;
	int left = 0;

	printf("Convert seconds to minutes and seconds!\n");
	printf("Enter the number of seconds (<=0 to quit):\n");
	scanf("%d", &sec);					// 读取秒数
	while(sec > 0)
	{
		min = sec / SEC_PER_MIN;		// 截断分钟数
		left = sec % SEC_PER_MIN;		// 剩下的秒数
		printf("%d seconds is %d minutes, %d seconds.\n", sec, min, left);
		printf("Enter next value(<=0 to quit):\n");
		scanf("%d",&sec);
	}
	printf("Done!\n");

	return 0;
}

